package com.fognl.core.net.handler;

/** Instances of this interface are called when handling of a request in the <code>NetworkHandler</code> class
 * completes.
 * @author kellys
 */
public interface ResponseListener
{
	/** Called when a piece of data is received, if the specified <code>Request</code>'s <code>Worker</code> 
	 * can support that operating mode. Otherwise, this method is not called, and the data associated
	 * with the request arrives in the <code>Response</code> object passed in <code>onRequestComplete()</code>. */
	void onDataReceived(Request request, Object data);
	
	/** Request is complete. */
	void onRequestComplete(Request request, Response response);
	
	/** Handle an exception indicating the cause of a failed retrieval. */
	void onRequestException(Request request, Throwable cause);
	
	/** Called when a request is cancelled. */
	void onRequestCancel(Request request);
	
	/** Called when a request times out. */
	void onRequestTimeout(Request request);
}
